# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:mapie1_0.py
@Time:2024/8/26 19:19

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""

# import mapie
#
# data = mapie.read_geo('榆社县/榆社县.shp')
#
# mapie.plot(data)
#
# mapie.save_map("my_awesome_map.png")

import geopandas as gpd
import matplotlib.pyplot as plt

# 读取形状文件
data = gpd.read_file('榆社县/榆社县.shp')

plt.rcParams['font.sans-serif'] = ['SimHei']  # 指定默认字体为SimHei
plt.rcParams['axes.unicode_minus'] = False  # 解决保存图像时负号'-'显示为方块的问题

# 绘制地图
fig, ax = plt.subplots(1, 1, figsize=(10, 6))
data.plot(ax=ax, color='lightblue', edgecolor='black')

# 可以在这里添加标题、图例等
ax.set_title('榆社县地图')

# 显示地图
plt.show()

# 保存地图为图片
plt.savefig("my_awesome_map.png", bbox_inches='tight', pad_inches=0)